
<!DOCTYPE html>
<html lang="ja">

<head>
<meta charset="utf-8">
<title>Shellcoder&#039;s Challenge!</title>
<script type="text/javascript" src="jquery-1.10.2.min.js"></script>
<script type="text/javascript">
function register()
{
	var p1 = document.getElementById("pass").value;
	var p2 = document.getElementById("pass2").value;
	
	if(p1 != p2){
		txt = "<font color=\"#ff0000\">pass err!</font>";
		document.getElementById("mes").innerHTML = txt;
		return;
	}
	
	$.post('cgi-bin/register.py',
		{
		'user': document.getElementById("user").value,
		'pass': document.getElementById("pass").value,
		'capt': document.getElementById("capt").value,
		'idnt': document.getElementById("idnt").value,
		'code': document.getElementById("code").value
		}, 
		function(data)
		{
			result = data.substring(0, 2);
			if(result == "ok"){
				location.href="login.html";
				return;
			}else if(result == "ye"){
				txt = "<font color=\"#ff0000\">exist err!</font>";
				document.getElementById("mes").innerHTML = txt;
			}else{
				txt = "<font color=\"#ff0000\">register err!</font>";
				document.getElementById("mes").innerHTML = txt;
			}
			repic();
		}
	);
}
function repic()
{
	var s = "0123456789";
	s += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	s += "abcdefghijklmnopqrstuvwxyz";

	var sid = "";
	for(var i=0; i < 32; i++){
		sid += s[Math.floor(Math.random() * s.length)];
	}

	$.post('cgi-bin/register.py',
		{
		'sid': sid
		},
		function(data)
		{
			result = data.substring(0, 2);
			if(result == "er"){
				return;
			}
			
			document.getElementById("idnt").value = sid;
			document.getElementById("code").value = data;
			
			var txt = "<div align=\"right\">";
			txt += "<img src=\"http://captchator.com/captcha/image/";
			txt += sid + "\" /></div>";
			document.getElementById("pic").innerHTML = txt;
		}
	);
}
</script>
</head>

<body>
<a href="http://www.seccon.jp/">
<img src="" width="191" height="34" alt="SECCON" border="0">
</a>

<h1>Shellcoder&#039;s Challenge!</h1>

<table border="0" width="400">
<tr valign="top">
<td>

<table border="0">
<tr><td>UserID:</td><td><input type="text" id="user" value=""></td></tr>
<tr><td>Password:</td><td><input type="password" id="pass" value=""></td></tr>
<tr><td><div align="right">(Re):</div></td><td><input type="password" id="pass2" value=""></td></tr>
<tr><td></td><td><div align="right"><a href="javascript:void(0);" onclick="javascript:repic();">show captcha</a></div></td></tr>
<tr><td></td><td id="pic"></td></tr>
<tr><td>Captcha:</td><td><input type="text" id="capt" value=""></td></tr>
<tr><td id="mes"></td><td><div align="right">
  <input type="button" value=" register " onclick="javascript:register(0)">
  </div></td></tr>
</table>
<input type="hidden" id="idnt" value="">
<input type="hidden" id="code" value="">

</td>

</tr>
</table>

</body>
</html>

